package com.carpark.ejb.DAO;

import com.carpark.ejb.Model.CarsModel;
import com.carpark.ejb.Model.EmployeesModel;
import com.carpark.ejb.Model.ParkingpassesModel;
import com.carpark.ejb.Model.ParkingspacesModel;
import com.carpark.ejb.Model.ParksModel;
import com.carpark.ejb.Model.PassesrecordsModel;
import com.carpark.ejb.Model.PaymentsModel;
import com.carpark.ejb.Model.ReceivablesModel;
import com.carpark.ejb.Model.ServicesModel;
import com.carpark.ejb.Model.TarrifsModel;
import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author Krzysztof
 */
public class IdSetter {

    private Calendar cal = Calendar.getInstance();
    private EmployeeDAOImpl instanceEmployee = new EmployeeDAOImpl();
    private ParkingpassesDAOImpl instanceParkingpasses = new ParkingpassesDAOImpl();
    private ParksDAOImpl instanceParks = new ParksDAOImpl();
    private TarrifsDAOImpl instanceTarrif = new TarrifsDAOImpl();
    private ReceivablesDAOImpl instanceReceivable = new ReceivablesDAOImpl();
    private PaymentsDAOImpl instancePayment = new PaymentsDAOImpl();
    private ParkingspacesDAOImpl instanceParkingSpaces = new ParkingspacesDAOImpl();
    private PassesrecordDAOImpl instancePassesRecord = new PassesrecordDAOImpl();
    private ServicesDAOImpl instanceService = new ServicesDAOImpl();


    private String convertIntToString(int number, int length) {
        String temp = number + "";
        int  k=length - temp.length();
        for (int i = 0; i < k; i++) {
            temp = "0" + temp;
        }
        return temp;
    }

    private String createDateString(Date date, Boolean isDayImportant) {
        cal.setTime(date);

        String DateString = "/" + convertIntToString(cal.get(Calendar.MONTH) + 1, 2) + "/" + cal.get(Calendar.YEAR);
        if (isDayImportant) {
       DateString = getDayToDateString(cal)+DateString;
        }
    
        return DateString;
    }

    private String getDayToDateString(Calendar cal) {
        return "/" + convertIntToString(cal.get(Calendar.DAY_OF_MONTH) + 1, 2);

    }
}
